{% extends "business/circuit_order.html" %}
{% block content %}
<div>
    <div class="row">
        <div class="col-md-4"><h5><strong>订单ID：{{ order.id }}</strong></h5></div>
        <div class="col-md-4"><h5><strong>所属的客户名称：</strong><a href="{% url "show_customer" customer.name %}">{{ customer.name }}</a></h5></div>
        <div class="col-md-4"><h5><strong>线路编号：</strong>{{ order.number }}</h5></div>
    </div>
    <br>

    <div class="row">
        <div class="col-md-4"><strong>订单类型：</strong>{{ order.type }}</div>
        <div class="col-md-4"><strong>带宽：</strong>{{ order.bandwith }}</div>
        <div class="col-md-4"><strong>当前状态：</strong>{{ order.status }}</div>
    </div>
    <br>

    <div class="row">
        <div class="col-md-4"><strong>本地运营商：</strong>{{ order.local_isp }}</div>
        <div class="col-md-4">
            <label for="local_ip">客户本地IP信息：</label>
            <textarea id="local_ip" class="form-control" rows="5" cols="40">
{{ order.local_ip }}
            </textarea>
         </div>
         <div class="col-md-4">
            <label for="hk_ip">分配的IP或者VPN帐号：</label>
            <textarea id="hk_ip" class="form-control" rows="5" cols="40">
{{ order.hk_ip }}
            </textarea>
         </div>
    </div>
    <br>

    <div class="row">
        <div class="col-md-4"><strong>路由器：</strong>{{ order.router }}</div>
        <div class="col-md-4"><strong>MRTG帐号：</strong>{{ order.mrtg }}</div>
        <div class="col-md-4"><strong>开始测试日期：</strong>{{ order.start_test }}</div>
    </div>
    <br>

    <div class="row">
        <div class="col-md-4"><strong>合同签约时长：</strong>{{ order.duration }}</div>
        <div class="col-md-4"><strong>开始计费日期：</strong>{{ order.start_billing }}</div>
        <div class="col-md-4">
            <label for="content">备注信息：</label>
            <textarea id="content" class="form-control" rows="5" cols="40">
{{ order.remark }}
            </textarea>
         </div>
    </div>
    <br>

    <div class="row">
        <div class="col-md-8"><strong>已上传的附件：</strong>
            {% if attachment_name %}
                <a href="/media/circuit_order/{{ order.customer.id }}/{{ attachment_name }}" download="{{ attachment_name }}">{{ attachment_name }}</a>
            {% endif %}
        </div>
    </div>
    <br>

    <div class="row">
         <div class="col-md-8"> 该信息被 {{ order.creator }} 于 {{ order.add_date }} 创建，被 {{ order.modifier }} 于 {{ order.mod_date }} 最后修改。</div>
    </div>
    <br>

    <a class="btn btn-primary" href="{% url "mod_circuit_order" order.id %}" role="button">编辑</a>
    <button id="DeleteCircuitOrder" class="btn btn-primary" href="" role="button">删除</button>
    <a class="btn btn-primary" href="{% url "add_ticket" order.id %}">添加Ticket</a>

    <script>
        $(function () {
            $("#DeleteCircuitOrder").click(function () {
                if(confirm("确定删除 订单编号: {{ order.number }} 的订单? 该订单的ticket信息也将被一起删除。")){
                    $.get("/business/del_circuit_order?circuit_order_id={{ order.id }}", function () {
                        window.location.replace("/business/circuit_order");
                    });
                }
            })
        })
    </script>
</div>

<hr>
<h4><strong>关联的Ticket</strong></h4>
<div class="well well-sm" id="tickets_info">
<table class="table table-hover table-condensed table-bordered">
    <thead>
        <tr>
            <td bgcolor="#C9C9C9">Ticket ID</td>
            <td bgcolor="#C9C9C9">故障级别</td>
            <td bgcolor="#C9C9C9">处理人</td>
            <td bgcolor="#C9C9C9">当前状态</td>
        </tr>
    </thead>
    <tbody>
    {% for ticket in tickets %}
        <tr class="success">
            <td><a href="{% url "show_ticket" ticket.id %}">{{ ticket.id }}</a></td>
            <td>{{ ticket.level }}</td>
            <td>{{ ticket.handler }}</td>
            <td>{{ ticket.status }}</td>
        </tr>
    {% endfor %}
    </tbody>
</table>
</div>
{% endblock %}
